package intelligentcity.model;

public class Point {

    private int x;
    private int y;

    public Point(int x, int y) {
        setX(x);
        setY(y);
    }
    
    public Point(Point point) {
        setX(point.getX());
        setY(point.getY());
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void incX() {
        x++;
    }

    public void decX() {
        x--;
    }

    public void incY() {
        y++;
    }

    public void decY() {
        y--;
    }

    public boolean inside(Point upperLeftCorner, Point bottomRightCorner) {
        if (x >= upperLeftCorner.getX() && x <= bottomRightCorner.getX() && y >= upperLeftCorner.getY()
                && y <= bottomRightCorner.getY()) {
            return true;
        }

        return false;
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof Point && ((Point) o).getX() == x && ((Point) o).getY() == y) {
            return true;
        }
        return false;
    }

    @Override
    public String toString() {
        return "(" + x + ", " + y + ")";
    }

}
